// wait for the DOM to be loaded 
//check var deault is first value  
var ck_resp="";
var ck_resp_text="";
$(document).ready(function() { 
    // add response begin
    $("#addresp_add").click(function(){
        $("#Msg_ResponseLable").hide();
        $("#Msg_ResponseValue").hide();
        if ($("#resp_label").val()==""){
            $("#Msg_ResponseLable").show();
            $("#resp_label").focus();
            return false;
        }
        if ($("#resp_value").val() == ""){
            $("#Msg_ResponseValue").show();
            $("#resp_value").focus();
            return false;
        }
        $.post('addresponse.html', {
            resp_id: "",
            resp_label: $("#resp_label").val(),
            resp_value:$("#resp_value").val(),
            Responsetype: $("#Responsetype").val(),
            Customtype: $("#Custom_UIControl").val(),
            Dynamictype: $("#Dynamic_UIControl").val()
        },
        function(data) {
            $('.response_type dl').html(data);
            $("#entries_value").val(data.split("</dd>").length-1);
            $("#resp_label").val("");
            $("#resp_value").val("");
            $("#resp_id").val("");
            $("#Msg_Custom").hide();
        });
    			 	
    });
    // add response end
    // add response begin
    $("#addresp").click(function(){
        $("#Msg_ResponseLable").hide();
        $("#Msg_ResponseValue").hide();
        if ($("#resp_label").val()==""){
            $("#Msg_ResponseLable").show();
            $("#resp_label").focus();
            return false;
        }
        if ($("#resp_value").val() == ""){
            $("#Msg_ResponseValue").show();
            $("#resp_value").focus();
            return false;
        }
        $.post('addresponse.html', {
            resp_id: $("#resp_id").val(),
            resp_label: $("#resp_label").val(),
            resp_value:$("#resp_value").val(),
            Responsetype: $("#Responsetype").val(),
            Customtype: $("#Custom_UIControl").val(),
            Dynamictype: $("#Dynamic_UIControl").val()
        },
        function(data) {
            $('.response_type dl').html(data);
            $("#entries_value").val(data.split("</dd>").length-1);
            //$("#Rsponse"+ck_resp).addClass("active");
            ck_resp ="";
            $("#resp_label").val("");
            $("#resp_value").val("");
            $("#resp_id").val("");
            $("#delresp_check").hide();
            $("#moveup_check").hide();
            $("#movedown_check").hide();
            $("#addresp_check").hide();
            $("#addresp_check_add").show();
            $("#delresp").hide();
            $("#moveup").hide();
            $("#movedown").hide();
            $("#addresp").hide();
            $("#addresp_add").show();
            $("#delresp_dropdown").hide();
            $("#moveup_dropdown").hide();
            $("#movedown_dropdown").hide();
            $("#addresp_dropdown").hide();
            $("#addresp_dropdown_add").show();
            $("#Msg_Custom").hide();
        });
    			 	
    });
    // add response end
    // del response begin
    $("#delresp").click(function(){
        if (ck_resp !=""){
            if (confirm("Are you sure you want to delete "+ck_resp_text+" response?")){
                $.post('delresponse.html',{
                    Responsetype: $("#Responsetype").val(),
                    Rid: ck_resp
                },
                function(data) {
                    //success
                    $('.response_type dl').html(data);
                    $("#entries_value").val(data.split("</dd>").length-1);
                    $("#resp_label").val(""),
                    $("#resp_value").val("");
                    $("#resp_id").val("");
                    ck_resp ="";
                    //--
                    $("#delresp_check").hide();
                    $("#moveup_check").hide();
                    $("#movedown_check").hide();
                    $("#addresp_check").hide();
                    $("#addresp_check_add").show();
                    $("#delresp").hide();
                    $("#moveup").hide();
                    $("#movedown").hide();
                    $("#addresp").hide();
                    $("#addresp_add").show();
                    $("#delresp_dropdown").hide();
                    $("#moveup_dropdown").hide();
                    $("#movedown_dropdown").hide();
                    $("#addresp_dropdown").hide();
                    $("#addresp_dropdown_add").show();
                });
            }
        }else{
            $("#Msg_SelectResponse").show();
            return false;
        }
    			 	
    });
    // del response end
    // movedown response begin
    $("#movedown").click(function(){
        if (ck_resp== ""){
            return false;
        }
        $.post('movedown.html',{
            Responsetype: $("#Responsetype").val(),
            Rid: ck_resp
        },
        function(data) {
            $('.response_type dl').html(data);
            $("#Rsponse"+ck_resp).addClass("active");
        });
    			 	
    });
    // movedown response end
    // moveup response begin
    $("#moveup").click(function(){
        if (ck_resp== ""){
            return false;
        }
        $.post('moveup.html',{
            Responsetype: $("#Responsetype").val(),
            Rid: ck_resp
        },
        function(data) {
            $('.response_type dl').html(data);
            $("#Rsponse"+ck_resp).addClass("active");
        });
    			 	
    });
    // moveup response end
    //------------------------
    // add response begin
    $("#addresp_check_add").click(function(){
        $("#Msg_ResponseLable").hide();
        $("#Msg_ResponseValue").hide()
        if ($("#resp_label_check").val()==""){
            $("#Msg_ResponseLable").show();
            $("#resp_label_check").focus();
            return false;
        }
        if ($("#resp_value_check").val() == ""){
            $("#Msg_ResponseValue").show();
            $("#resp_value_check").focus();
            return false;
        }
        $.post('addresponse.html', {
            resp_id: "",
            resp_label: $("#resp_label_check").val(),
            resp_value:$("#resp_value_check").val(),
            Responsetype: $("#Responsetype").val(),
            Customtype: $("#Custom_UIControl").val(),
            Dynamictype: $("#Dynamic_UIControl").val()
        },
        function(data) {
            $('.response_type_check dl').html(data);
            $("#entries_value_check").val(data.split("</dd>").length-1);
            $("#resp_label_check").val("");
            $("#resp_value_check").val("");
            $("#resp_id_check").val("");
            $("#Msg_Custom").hide();
        });
    			 	
    });
    // add response begin
    $("#addresp_check").click(function(){
        $("#Msg_ResponseLable").hide();
        $("#Msg_ResponseValue").hide()
        if ($("#resp_label_check").val()==""){
            $("#Msg_ResponseLable").show();
            $("#resp_label_check").focus();
            return false;
        }
        if ($("#resp_value_check").val() == ""){
            $("#Msg_ResponseValue").show();
            $("#resp_value_check").focus();
            return false;
        }
        $.post('addresponse.html', {
            resp_id: $("#resp_id_check").val(),
            resp_label: $("#resp_label_check").val(),
            resp_value:$("#resp_value_check").val(),
            Responsetype: $("#Responsetype").val(),
            Customtype: $("#Custom_UIControl").val(),
            Dynamictype: $("#Dynamic_UIControl").val()
        },
        function(data) {
            $('.response_type_check dl').html(data);
            $("#entries_value_check").val(data.split("</dd>").length-1);
            //$("#Rsponse"+ck_resp).addClass("active");
            ck_resp ="";
            $("#resp_label_check").val("");
            $("#resp_value_check").val("");
            $("#resp_id_check").val("");
            $("#delresp_check").hide();
            $("#moveup_check").hide();
            $("#movedown_check").hide();
            $("#addresp_check").hide();
            $("#addresp_check_add").show();
            $("#delresp").hide();
            $("#moveup").hide();
            $("#movedown").hide();
            $("#addresp").hide();
            $("#addresp_add").show();
            $("#delresp_dropdown").hide();
            $("#moveup_dropdown").hide();
            $("#movedown_dropdown").hide();
            $("#addresp_dropdown").hide();
            $("#addresp_dropdown_add").show();
            $("#Msg_Custom").hide();
        });
    			 	
    });
    // add response end
    // del response begin
    $("#delresp_check").click(function(){
        if (ck_resp !=""){
            $("#Msg_SelectResponse").hide();
            if (confirm("Are you sure you want to delete  "+ck_resp_text+"response?")){
                $.post('delresponse.html',{
                    Responsetype: $("#Responsetype").val(),
                    Rid: ck_resp
                },
                function(data) {
                    //success
                    $('.response_type_check dl').html(data);
                    $("#entries_value_check").val(data.split("</dd>").length-1);
                    $("#resp_label_check").val("");
                    $("#resp_value_check").val("");
                    $("#resp_id_check").val("");
                    ck_resp ="";
                    //----
                    $("#delresp_check").hide();
                    $("#moveup_check").hide();
                    $("#movedown_check").hide();
                    $("#addresp_check").hide();
                    $("#addresp_check_add").show();
                    $("#delresp").hide();
                    $("#moveup").hide();
                    $("#movedown").hide();
                    $("#addresp").hide();
                    $("#addresp_add").show();
                    $("#delresp_dropdown").hide();
                    $("#moveup_dropdown").hide();
                    $("#movedown_dropdown").hide();
                    $("#addresp_dropdown").hide();
                    $("#addresp_dropdown_add").show();
                });
            }
        }else{
            $("#Msg_SelectResponse").show();
            return false;
        }
    			 	
    });
    // del response end
    // movedown response begin
    $("#movedown_check").click(function(){
        if (ck_resp== ""){
            return false;
        }
        $.post('movedown.html',{
            Responsetype: $("#Responsetype").val(),
            Rid: ck_resp
        },
        function(data) {
            $(this).addClass("active");
            $('.response_type_check dl').html(data);           
            $("#Rsponse"+ck_resp).addClass("active");
        });
    			 	
    });
    // movedown response end
    // moveup response begin
    $("#moveup_check").click(function(){
        if (ck_resp== ""){
            return false;
        }
        $.post('moveup.html',{
            Responsetype: $("#Responsetype").val(),
            Rid: ck_resp
        },
        function(data) {
            $(this).addClass("active");
            $('.response_type_check dl').html(data);
            $("#Rsponse"+ck_resp).addClass("active");
        });
    			 	
    });
    // moveup response end
    //------------------------
    // add response begin
    $("#addresp_dropdown_add").click(function(){
        $("#Msg_ResponseLable").hide();
        $("#Msg_ResponseValue").hide()
        if ($("#resp_label_dropdown").val()==""){
            $("#Msg_ResponseLable").show();
            $("#resp_label_dropdown").focus();
            return false;
        }
        if ($("#resp_value_dropdown").val() == ""){
            $("#Msg_ResponseValue").show();
            $("#resp_value_dropdown").focus();
            return false;
        }
        $.post('addresponse.html', {
            resp_id: "",
            resp_label: $("#resp_label_dropdown").val(),
            resp_value:$("#resp_value_dropdown").val(),
            Responsetype: $("#Responsetype").val(),
            Customtype: $("#Custom_UIControl").val(),
            Dynamictype: $("#Dynamic_UIControl").val()
        },
        function(data) {
            $('.response_type_dropdown dl').html(data);
            $("#entries_value_dropdown").val(data.split("</dd>").length-1);
            $("#resp_label_dropdown").val("");
            $("#resp_value_dropdown").val("");
            $("#resp_id_dropdown").val("");
            $("#Msg_Custom").hide();
        });
    			 	
    });
    // add response begin
    $("#addresp_dropdown").click(function(){
        $("#Msg_ResponseLable").hide();
        $("#Msg_ResponseValue").hide()
        if ($("#resp_label_dropdown").val()==""){
            $("#Msg_ResponseLable").show();
            $("#resp_label_dropdown").focus();
            return false;
        }
        if ($("#resp_value_dropdown").val() == ""){
            $("#Msg_ResponseValue").show();
            $("#resp_value_dropdown").focus();
            return false;
        }
        $.post('addresponse.html', {
            resp_id: $("#resp_id_dropdown").val(),
            resp_label: $("#resp_label_dropdown").val(),
            resp_value:$("#resp_value_dropdown").val(),
            Responsetype: $("#Responsetype").val(),
            Customtype: $("#Custom_UIControl").val(),
            Dynamictype: $("#Dynamic_UIControl").val()
        },
        function(data) {
            $('.response_type_dropdown dl').html(data);
            $("#entries_value_dropdown").val(data.split("</dd>").length-1);
            //$("#Rsponse"+ck_resp).addClass("active");
            $("#resp_label_dropdown").val("");
            $("#resp_value_dropdown").val("");
            $("#resp_id_dropdown").val("");
            ck_resp ="";
            //--
            $("#delresp_check").hide();
            $("#moveup_check").hide();
            $("#movedown_check").hide();
            $("#addresp_check").hide();
            $("#addresp_check_add").show();
            $("#delresp").hide();
            $("#moveup").hide();
            $("#movedown").hide();
            $("#addresp").hide();
            $("#addresp_add").show();
            $("#delresp_dropdown").hide();
            $("#moveup_dropdown").hide();
            $("#movedown_dropdown").hide();
            $("#addresp_dropdown").hide();
            $("#addresp_dropdown_add").show();
            $("#Msg_Custom").hide();
        });
    			 	
    });
    // add response end
    // del response begin
    $("#delresp_dropdown").click(function(){
        if (ck_resp !=""){
            if (confirm("Are you sure you want to delete "+ck_resp_text+"response?")){
                $.post('delresponse.html',{
                    Responsetype: $("#Responsetype").val(),
                    Rid: ck_resp
                },
                function(data) {
                    //success
                    $('.response_type_dropdown dl').html(data);
                    $("#entries_value_dropdown").val(data.split("</dd>").length-1);
                    $("#resp_label_dropdown").val("");
                    $("#resp_value_dropdown").val("");
                    $("#resp_id_dropdown").val("");
                    ck_resp ="";
                    //---
                    $("#delresp_check").hide();
                    $("#moveup_check").hide();
                    $("#movedown_check").hide();
                    $("#addresp_check").hide();
                    $("#addresp_check_add").show();
                    $("#delresp").hide();
                    $("#moveup").hide();
                    $("#movedown").hide();
                    $("#addresp").hide();
                    $("#addresp_add").show();
                    $("#delresp_dropdown").hide();
                    $("#moveup_dropdown").hide();
                    $("#movedown_dropdown").hide();
                    $("#addresp_dropdown").hide();
                    $("#addresp_dropdown_add").show();
                });
            }
        }else{
            $("#Msg_SelectResponse").show();
            return false;
        }
    			 	
    });
    // del response end
    // movedown response begin
    $("#movedown_dropdown").click(function(){
        if (ck_resp== ""){
            return false;
        }
        $.post('movedown.html',{
            Responsetype: $("#Responsetype").val(),
            Rid: ck_resp
        },
        function(data) {
            $(this).addClass("active");
            $('.response_type_dropdown dl').html(data);
            $("#Rsponse"+ck_resp).addClass("active");
        });
    			 	
    });
    // movedown response end
    // moveup response begin
    $("#moveup_dropdown").click(function(){
        if (ck_resp== ""){
            return false;
        }
        $.post('moveup.html',{
            Responsetype: $("#Responsetype").val(),
            Rid: ck_resp
        },
        function(data) {
            $(this).addClass("active");
            $('.response_type_dropdown dl').html(data);
            $("#Rsponse"+ck_resp).addClass("active");
        });
    			 	
    });
    // moveup response end
    // add /update change on begin
            
    $("#delresp_check").hide();
    $("#moveup_check").hide();
    $("#movedown_check").hide();
    $("#addresp_check").hide();
    $("#addresp_check_add").show();
    $("#delresp").hide();
    $("#moveup").hide();
    $("#movedown").hide();
    $("#addresp").hide();
    $("#addresp_add").show();
    $("#delresp_dropdown").hide();
    $("#moveup_dropdown").hide();
    $("#movedown_dropdown").hide();
    $("#addresp_dropdown").hide();
    $("#addresp_dropdown_add").show();
// add /update change on end
}); 
function CheckIt(obj,LabelId){     	
    var FirstFlag = $(obj).attr("class"); 
    
    $("#div_checkbox dl dd").removeClass("active");
    $("#div_radiobutton dl dd").removeClass("active");
    $("#div_dropdown dl dd").removeClass("active");
    //$(obj).toggleClass("active");
    ck_resp = LabelId;
    var ck_resp_value = $("#"+$(obj).attr("id")+" div strong").text();
    ck_resp_text = $("#"+$(obj).attr("id")+" div em").text();
    if (FirstFlag !="active"){
        $(obj).addClass("active");
        show4button();
        $("#resp_label_check").val(ck_resp_value);
        $("#resp_value_check").val(ck_resp_text);
        $("#resp_id_check").val(LabelId);
        $("#resp_label").val(ck_resp_value);
        $("#resp_value").val(ck_resp_text);
        $("#resp_id").val(LabelId);
        $("#resp_label_dropdown").val(ck_resp_value);
        $("#resp_value_dropdown").val(ck_resp_text);
        $("#resp_id_dropdown").val(LabelId);
    }else{
        $(obj).removeClass("active");
        ck_resp = "";
        hide4button();
        $("#resp_label_check").val("");
        $("#resp_value_check").val("");
        $("#resp_id_check").val("");
        $("#resp_label").val("");
        $("#resp_value").val("");
        $("#resp_id").val("");
        $("#resp_label_dropdown").val("");
        $("#resp_value_dropdown").val("");
        $("#resp_id_dropdown").val("");
    }
    
}
function show4button(){
    $("#delresp_check").show();
    $("#moveup_check").show();
    $("#movedown_check").show();
    $("#addresp_check").show();
    $("#addresp_check_add").hide();
     		
    $("#delresp").show();
    $("#moveup").show();
    $("#movedown").show();
    $("#addresp").show();
    $("#addresp_add").hide();
     		
    $("#delresp_dropdown").show();
    $("#moveup_dropdown").show();
    $("#movedown_dropdown").show();
    $("#addresp_dropdown").show();
    $("#addresp_dropdown_add").hide();
}
function hide4button(){
    $("#delresp_check").hide();
    $("#moveup_check").hide();
    $("#movedown_check").hide();
    $("#addresp_check").hide();
    $("#addresp_check_add").show();
    $("#delresp").hide();
    $("#moveup").hide();
    $("#movedown").hide();
    $("#addresp").hide();
    $("#addresp_add").show();
    $("#delresp_dropdown").hide();
    $("#moveup_dropdown").hide();
    $("#movedown_dropdown").hide();
    $("#addresp_dropdown").hide();
    $("#addresp_dropdown_add").show();
}
var iniSq = function(){
    $("#minResponseValue_sq_textarea").val("");
    $("#maxResponseValue_sq_textarea").val("");
    $("#maxResponseValue_sq_float").val("");
    $("#minResponseValue_sq_float").val("");
    $("#maxResponseValue_sq_int").val("");
    $("#minResponseValue_sq_int").val("");
    $("#minResponseValue_sq_date").val("");
    $("#maxResponseValue_sq_date").val("");
    $("#maxResponses_sq_checkbox").val("");
    $("#maxResponses_sq_float").val("");
    $("#Units_float").val("");
    $("#Units_int").val("");
    $("#Units_string").val("");
    $("#width").val("");
    $("#rows").val("");
    $("#resp_label_check").val("");
    $("#resp_value_check").val("");
    $("#resp_id_check").val("");
    $("#resp_label").val("");
    $("#resp_value").val("");
    $("#resp_id").val("");
    $("#resp_label_dropdown").val("");
    $("#resp_value_dropdown").val("");
    $("#resp_id_dropdown").val("");
    $("#display_width").val("");
}
var ChangeType = function(TypeName){
    iniSq();
    var div_radiobutton = document.getElementById("div_radiobutton");
    var div_none = document.getElementById("div_none");
    var div_textarea = document.getElementById("div_textarea");
    var div_checkbox = document.getElementById("div_checkbox");
    var div_float = document.getElementById("div_float");
    var div_date = document.getElementById("div_date");
    var div_custom = document.getElementById("div_custom");
    var div_dynamic = document.getElementById("div_dynamic");
    var div_dropdown = document.getElementById("div_dropdown");
    var div_int = document.getElementById("div_int");
    var div_display = document.getElementById("div_display");
    msgHide();
    if (TypeName =="Please Select"){
        $("#Msg_Responsetype").show();
    }else{
        $("#Msg_Responsetype").hide();
    }

    if (TypeName=="Please Select" || TypeName=="Yes/No" || TypeName=="No/Yes" || TypeName=="Social Security Number" || TypeName=="Phone Number" || TypeName=="Email Address" || TypeName=="US States" || TypeName=="No response" ){
        div_custom.style.display="none";
        div_dynamic.style.display="none";
        div_radiobutton.style.display="none";
        div_none.style.display="none";
        div_textarea.style.display="none";
        div_checkbox.style.display="none";
        //div_string.style.display="none";
        div_float.style.display="none";
        div_date.style.display="none";
        div_dropdown.style.display="none";
        div_int.style.display="none";
        div_display.style.display="none";
    }
    if (TypeName=="Display"){    	
    	div_display.style.display="";
        div_custom.style.display="none";
        div_dynamic.style.display="none";
        div_radiobutton.style.display="none";
        div_none.style.display="none";
        div_textarea.style.display="none";
        div_checkbox.style.display="none";
        //div_string.style.display="none";
        div_float.style.display="none";
        div_date.style.display="none";
        div_dropdown.style.display="none";
        div_int.style.display="none";        
    }
    if (TypeName=="Custom"){
        $("#Custom_UIControl").val("0");
        $("#Custom_DataType").val("0");
        $("#Dynamic_UIControl").val("0");
        $("#Dynamic_DataType").val("0");
        div_custom.style.display="";
        div_dynamic.style.display="none";
        div_radiobutton.style.display="none";
        div_none.style.display="none";
        div_textarea.style.display="none";
        div_checkbox.style.display="none";
        //div_string.style.display="none";
        div_float.style.display="none";
        div_date.style.display="none";
        div_dropdown.style.display="none";
        div_int.style.display="none";
        div_display.style.display="none";
        //check exist session response type, if exist then delete it
        $.post('checkresponse.html',
            function(data) {
                $("#resp_label_check").val("");
                $("#resp_value_check").val("");
                $("#resp_id_check").val("");
                $("#resp_label").val("");
                $("#resp_value").val("");
                $("#resp_id").val("");
                $("#resp_label_dropdown").val("");
                $("#resp_value_dropdown").val("");
                $("#resp_id_dropdown").val("");
                $("#Custom_DataType").val("0");
                return false;
            });
        div_custom.style.display="";
        div_dynamic.style.display="none";
        div_radiobutton.style.display="none";
        div_none.style.display="none";
        div_textarea.style.display="none";
        div_checkbox.style.display="none";
        //div_string.style.display="none";
        div_float.style.display="none";
        div_date.style.display="none";
        div_dropdown.style.display="none";
        div_int.style.display="none";
    }
    if (TypeName=="Dynamic"){
        $("#Custom_UIControl").val("0");
        $("#Custom_DataType").val("0");
        $("#Dynamic_UIControl").val("0");
        $("#Dynamic_DataType").val("0");
        div_dynamic.style.display="";
        div_custom.style.display="none";
        div_radiobutton.style.display="none";
        div_none.style.display="none";
        div_textarea.style.display="none";
        div_checkbox.style.display="none";
        //div_string.style.display="none";
        div_float.style.display="none";
        div_date.style.display="none";
        div_dropdown.style.display="none";
        div_int.style.display="none";
        div_display.style.display="none";
        //check exist session response type, if exist then delete it
        $.post('checkresponse.html',
            function(data) {
                $("#resp_label_check").val("");
                $("#resp_value_check").val("");
                $("#resp_id_check").val("");
                $("#resp_label").val("");
                $("#resp_value").val("");
                $("#resp_id").val("");
                $("#resp_label_dropdown").val("");
                $("#resp_value_dropdown").val("");
                $("#resp_id_dropdown").val("");
                $("#Custom_DataType").val("0");
                return false;
            });
        div_dynamic.style.display="";
        div_custom.style.display="none";
        div_radiobutton.style.display="none";
        div_none.style.display="none";
        div_textarea.style.display="none";
        div_checkbox.style.display="none";
        //div_string.style.display="none";
        div_float.style.display="none";
        div_date.style.display="none";
        div_dropdown.style.display="none";
        div_int.style.display="none";
        div_display.style.display="none";
    }
}
var ChangeTypeBy = function(TypeName){			
    iniSq();
    $("#Custom_DataType").val("0");
    var div_radiobutton = document.getElementById("div_radiobutton");
    var div_none = document.getElementById("div_none");
    var div_textarea = document.getElementById("div_textarea");
    var div_checkbox = document.getElementById("div_checkbox");
    var div_string = document.getElementById("div_string");
    var div_float = document.getElementById("div_float");
    var div_date = document.getElementById("div_date");
    var div_custom = document.getElementById("div_custom");
    var div_dynamic = document.getElementById("div_dynamic");
    var div_dropdown = document.getElementById("div_dropdown");
    var div_int = document.getElementById("div_int"); 
    var div_display = document.getElementById("div_display");   
    if (TypeName =="Please Select"){
        $("#Msg_UIControl").show();
    }else{
        $("#Msg_UIControl").hide();
    }
    msgHide();
    div_display.style.display="none";
    if (TypeName=="Radio Button"){
        //$("#Dynamic_DataType").hide();
        //$("#Custom_DataType").hide();
        //$("#Dynamic_DataType_label").hide();
        //$("#Custom_DataType_label").hide();
        iniSq();
        $("#resp_label").val("");
        $("#resp_value").val("");
        $("#resp_id").val("");
        $("#resp_label_dropdown").val("");
        $("#resp_value_dropdown").val("");
        $("#resp_id_dropdown").val("");
        $("#resp_label_check").val("");
        $("#resp_value_check").val("");
        $("#resp_id_check").val("");
        $("#delresp").hide();
        $("#moveup").hide();
        $("#movedown").hide();
        $("#addresp").hide();
        $("#addresp_add").show();
        div_radiobutton.style.display="";
        div_none.style.display="none";
        div_textarea.style.display="none";
        div_checkbox.style.display="none";
        div_string.style.display="none";
        div_float.style.display="none";
        div_date.style.display="none";
        div_dropdown.style.display="none";
        div_int.style.display="none";
        //check exist session response type, if exist then delete it
        $.post('checkresponse.html',
            function(data) {
                $('.response_type dl').html("");
                $("#entries_value").val("0");
                $("#resp_label_check").val("");
                $("#resp_value_check").val("");
                $("#resp_id_check").val("");
                $("#resp_label").val("");
                $("#resp_value").val("");
                $("#resp_id").val("");
                $("#resp_label_dropdown").val("");
                $("#resp_value_dropdown").val("");
                $("#resp_id_dropdown").val("");
                return false;
            });
							
    }
    if (TypeName=="Dropdown"){
        //$("#Dynamic_DataType").hide();
        //$("#Custom_DataType").hide();
        //$("#Dynamic_DataType_label").hide();
        //$("#Custom_DataType_label").hide();
        iniSq();
        $("#resp_label").val("");
        $("#resp_value").val("");
        $("#resp_id").val("");
        $("#resp_label_dropdown").val("");
        $("#resp_value_dropdown").val("");
        $("#resp_id_dropdown").val("");
        $("#resp_label_check").val("");
        $("#resp_value_check").val("");
        $("#resp_id_check").val("");
        $("#delresp_dropdown").hide();
        $("#moveup_dropdown").hide();
        $("#movedown_dropdown").hide();
        $("#addresp_dropdown").hide();
        $("#addresp_dropdown_add").show();
        div_dropdown.style.display="";
        div_radiobutton.style.display="none";
        div_none.style.display="none";
        div_textarea.style.display="none";
        div_checkbox.style.display="none";
        div_string.style.display="none";
        div_float.style.display="none";
        div_date.style.display="none";
        div_int.style.display="none";
        //check exist session response type, if exist then delete it
        $.post('checkresponse.html',
            function(data) {
                $('.response_type_dropdown dl').html("");
                $("#entries_value_dropdown").val("0");
                $("#resp_label_check").val("");
                $("#resp_value_check").val("");
                $("#resp_id_check").val("");
                $("#resp_label").val("");
                $("#resp_value").val("");
                $("#resp_id").val("");
                $("#resp_label_dropdown").val("");
                $("#resp_value_dropdown").val("");
                $("#resp_id_dropdown").val("");
                return false;
            });
    }
    if (TypeName=="Check Box"){
        iniSq();
        $("#resp_label").val("");
        $("#resp_value").val("");
        $("#resp_id").val("");
        $("#resp_label_dropdown").val("");
        $("#resp_value_dropdown").val("");
        $("#resp_id_dropdown").val("");
        $("#resp_label_check").val("");
        $("#resp_value_check").val("");
        $("#resp_id_check").val("");
        $("#delresp_check").hide();
        $("#moveup_check").hide();
        $("#movedown_check").hide();
        $("#addresp_check").hide();
        $("#addresp_check_add").show();
        div_checkbox.style.display="";
        div_none.style.display="none";
        div_textarea.style.display="none";
        div_radiobutton.style.display="none";
        div_string.style.display="none";
        div_float.style.display="none";
        div_date.style.display="none";
        div_dropdown.style.display="none";
        div_int.style.display="none";
        //check exist session response type, if exist then delete it
        $.post('checkresponse.html',
            function(data) {
                $('.response_type_check dl').html("");
                $("#entries_value_check").val("0");
                $("#resp_label_check").val("");
                $("#resp_value_check").val("");
                $("#resp_id_check").val("");
                $("#resp_label").val("");
                $("#resp_value").val("");
                $("#resp_id").val("");
                $("#resp_label_dropdown").val("");
                $("#resp_value_dropdown").val("");
                $("#resp_id_dropdown").val("");
                return false;
            });
    }
    if (TypeName=="Please Select" || TypeName=="Text Box" || TypeName=="Text Area"){
        iniSq();
        div_date.style.display="none";
        div_radiobutton.style.display="none";
        div_textarea.style.display="none";
        div_checkbox.style.display="none";
        div_string.style.display="none";
        div_float.style.display="none";
        div_none.style.display="none";
        div_dropdown.style.display="none";
        div_int.style.display="none";
    }
}
var ChangeCustomBy = function(TypeName){
    iniSq();
    var ResponseType = $("#Custom_UIControl").val();
    var div_radiobutton = document.getElementById("div_radiobutton");
    var div_none = document.getElementById("div_none");
    var div_textarea = document.getElementById("div_textarea");
    var div_checkbox = document.getElementById("div_checkbox");
    var div_string = document.getElementById("div_string");
    var div_float = document.getElementById("div_float");
    var div_date = document.getElementById("div_date");
    var div_custom = document.getElementById("div_custom");
    var div_dynamic = document.getElementById("div_dynamic");
    var div_dropdown = document.getElementById("div_dropdown");
    var div_int = document.getElementById("div_int");
    var div_display = document.getElementById("div_display");
    if ($("#Custom_UIControl").val()=="Dropdown" || $("#Custom_UIControl").val()=="Radio Button" || $("#Custom_UIControl").val()=="Check Box"){
        return false;
    }
    if (TypeName =="Please Select"){
        $("#Msg_DataType").show();
    }else{
        $("#Msg_DataType").hide();
    }
    div_display.style.display="none";
    msgHide();
    if (TypeName=="Please Select"){
        iniSq();
        div_date.style.display="none";
        div_radiobutton.style.display="none";
        div_textarea.style.display="none";
        div_checkbox.style.display="none";
        div_string.style.display="none";
        div_float.style.display="none";
        div_none.style.display="none";
        div_dropdown.style.display="none";
        div_int.style.display="none";
    }
    if ((ResponseType=="Text Box" && TypeName=="Boolean") || (ResponseType=="Text Box" && TypeName=="Boolean")){
        //invalid
        iniSq();
        div_date.style.display="none";
        div_radiobutton.style.display="none";
        div_textarea.style.display="none";
        div_checkbox.style.display="none";
        div_string.style.display="none";
        div_float.style.display="none";
        div_none.style.display="none";
        div_dropdown.style.display="none";
        div_int.style.display="none";
    }
    if ((ResponseType == "Text Box" && TypeName=="String") || (ResponseType == "Text Area" && TypeName=="Date") || (ResponseType == "Text Area" && TypeName=="Float") || (ResponseType == "Text Area" && TypeName=="Boolean") || (ResponseType == "Text Area" && TypeName=="DateTime") || (ResponseType == "Text Area" && TypeName=="Integer")){
        //invalid
        iniSq();
        div_date.style.display="none";
        div_radiobutton.style.display="none";
        div_textarea.style.display="none";
        div_checkbox.style.display="none";
        div_string.style.display="none";
        div_float.style.display="none";
        div_none.style.display="none";
        div_dropdown.style.display="none";
        div_int.style.display="none";
    }
    if (ResponseType == "Text Box" && TypeName=="Date"){
        iniSq();
        div_date.style.display="";
        div_radiobutton.style.display="none";
        div_textarea.style.display="none";
        div_checkbox.style.display="none";
        div_string.style.display="none";
        div_float.style.display="none";
        div_none.style.display="none";
        div_dropdown.style.display="none";
        div_int.style.display="none";
    }
    if (ResponseType == "Text Area" && TypeName=="String"){
        iniSq();
        div_textarea.style.display="";
        div_radiobutton.style.display="none";
        div_date.style.display="none";
        div_checkbox.style.display="none";
        div_string.style.display="none";
        div_float.style.display="none";
        div_none.style.display="none";
        div_dropdown.style.display="none";
        div_int.style.display="none";
    }
    if (ResponseType == "Text Box" && TypeName=="String"){
        iniSq();
        div_string.style.display="";
        div_radiobutton.style.display="none";
        div_textarea.style.display="none";
        div_checkbox.style.display="none";
        div_date.style.display="none";
        div_float.style.display="none";
        div_none.style.display="none";
        div_dropdown.style.display="none";
        div_int.style.display="none";
    }
    if (ResponseType == "Text Box" && TypeName=="Float"){
        iniSq();
        div_float.style.display="";
        div_radiobutton.style.display="none";
        div_date.style.display="none";
        div_checkbox.style.display="none";
        div_string.style.display="none";
        div_textarea.style.display="none";
        div_none.style.display="none";
        div_dropdown.style.display="none";
        div_int.style.display="none";
    }
    if (ResponseType == "Text Box" && TypeName=="Integer"){
        iniSq();
        div_int.style.display="";
        div_float.style.display="none";
        div_radiobutton.style.display="none";
        div_date.style.display="none";
        div_checkbox.style.display="none";
        div_string.style.display="none";
        div_textarea.style.display="none";
        div_none.style.display="none";
        div_dropdown.style.display="none";
    }
		
}

function transferText() {
	var ifrdoc=$("#rte_box iframe")[0].contentWindow.document;
	var hml = ifrdoc.body.innerHTML;
	if ($.browser.msie && /<\/?p>/gi.test(hml))
		hml=hml.replace(/<p>/gi,"").replace(/<\/p>/gi, "<br />");
	if (/\r\n|\n/.test(hml))
		hml = hml.replace(/\r\n|\n/ig,"");
	$("#text").remove();
	return hml;
}

function jumpAction(submitAction) {
    $("#Msg_name").html();
    $("#Msg_vocabularyname").html();
    $("#Msg_text").html();
    $("#Msg_description").html();
    $("#Msg_helpText").html();
    $("#Msg_helpText").hide();
    $("#Msg_description").hide();
    $("#Msg_name").hide();   
    $("#Msg_text").hide();  
    $("#Msg_vocabularyname").hide(); 
    $("#Msg_Width").hide();
    $("#Msg_Rows").hide();
	var displayWidthFlag = $("#div_display").css("display");	
	if (displayWidthFlag == "none"){
		$("#display_width").val("");
	}
	
    $.post('checkcreate.html',{        
        name:$("#name").val(),
        vocabularyname:$("#vocabularyname").val(),
        text:transferText(),
        description:$("#description").val(),
        helpText:$("#helpText").val()
    },
    function(returndata) {     	
        if (returndata !=""){            
            var datas = returndata.split(";");
            for (i=0;i<datas.length-1;i++){
                var error = datas[i].split(":");
                $("#Msg_"+error[0]).html(error[1]);
                $("#Msg_"+error[0]).show();
            }             
            return false;
        }else{            
            $("#Msg_name").hide();           
            $("#Msg_text").hide();
            $("#Msg_vocabularyname").hide();
            var ResponseType = $("#Responsetype").val();
            if (ResponseType == "0"){
                $("#Msg_Responsetype").show();
                $("#Responsetype").focus();
                return false;
            }
            // check responsetype dynamic and custom/datatype
            // check session and find responseentity is null!

            if (ResponseType =="Dynamic"){
                if ($("#Dynamic_UIControl").val()=="0"){                    
                    $("#Msg_Responsetype").hide();
                    $("#Msg_Width").hide();
                    $("#Msg_Rows").hide();
                    $("#Msg_UIControl").show();
                    $("#Dynamic_UIControl").focus();
                    return false;
                }
            }
            if (ResponseType =="Custom"){
                if ($("#Custom_UIControl").val()=="0"){
                    $("#Msg_Responsetype").hide();
                    $("#Msg_Width").hide();
                    $("#Msg_Rows").hide();
                    $("#Msg_UIControl").show();
                    $("#Custom_UIControl").focus();
                    return false;
                }
            }
            if (ResponseType =="Custom" || ResponseType =="Dynamic"){ 
                if ($("#Dynamic_UIControl").val()=="Radio Button" || $("#Custom_UIControl").val()=="Radio Button"){

                    $("#Msg_Custom").hide();
                    var haveitems = $('.response_type dl').html();
                    if (haveitems == ""){
                        $("#Msg_Responsetype").hide();
                        $("#Msg_UIControl").hide();
                        $("#Msg_Width").hide();
                        $("#Msg_Rows").hide();
                        $("#Msg_Custom").show();
                        $("#resp_label").focus();
                        return false;
                    }
                }
                if ($("#Dynamic_UIControl").val()=="Check Box" || $("#Custom_UIControl").val()=="Check Box"){
                    $("#Msg_Custom").hide();
                    var haveitems = $('.response_type_check dl').html();
                    if (haveitems == ""){
                        $("#Msg_Responsetype").hide();
                        $("#Msg_UIControl").hide();
                        $("#Msg_Width").hide();
                        $("#Msg_Rows").hide();
                        $("#Msg_Custom").show();
                        $("#resp_label_check").focus();
                        return false;
                    }
                }
                if ($("#Dynamic_UIControl").val()=="Dropdown" || $("#Custom_UIControl").val()=="Dropdown"){
                    $("#Msg_Custom").hide();
                    var haveitems = $('.response_type_dropdown dl').html();
                    if (haveitems == ""){
                        $("#Msg_Responsetype").hide();
                        $("#Msg_UIControl").hide();
                        $("#Msg_Width").hide();
                        $("#Msg_Rows").hide();
                        $("#Msg_Custom").show();
                        $("#resp_label_dropdown").focus();
                        return false;
                    }
                }
                if ($("#Custom_UIControl").val()=="Text Box" || $("#Custom_UIControl").val()=="Text Area"){
                   if ($("#Custom_DataType").val() =="0"){
                        $("#Msg_Responsetype").hide();
                        $("#Msg_UIControl").hide();
                        $("#Msg_Custom").hide();
                        $("#Msg_Width").hide();
                        $("#Msg_Rows").hide();
                        $("#Msg_DataType").show();
                        $("#Custom_DataType").focus();
                        return false;
                    }                    
                }

                if ($("#Custom_UIControl").val()=="Text Box" && $("#Custom_DataType").val()=="Boolean"){
                    $("#Msg_Responsetype").hide();
                    $("#Msg_UIControl").hide();
                    $("#Msg_Custom").hide();
                    $("#Msg_DataType").hide();
                    $("#Msg_Width").hide();
                    $("#Msg_Rows").hide();
                    $("#Msg_Invalid").show();
                    return false;
                }
                if ($("#Custom_UIControl").val()=="Text Area" && $("#Custom_DataType").val()=="Float"){
                    $("#Msg_Responsetype").hide();
                    $("#Msg_UIControl").hide();
                    $("#Msg_Custom").hide();
                    $("#Msg_DataType").hide();
                    $("#Msg_Width").hide();
                    $("#Msg_Rows").hide();
                    $("#Msg_Invalid").show();
                    return false;
                }
                if ($("#Custom_UIControl").val()=="Text Area" && $("#Custom_DataType").val()=="Boolean"){
                    $("#Msg_Responsetype").hide();
                    $("#Msg_UIControl").hide();
                    $("#Msg_Custom").hide();
                    $("#Msg_DataType").hide();
                    $("#Msg_Width").hide();
                    $("#Msg_Rows").hide();
                    $("#Msg_Invalid").show();
                    return false;
                }
                if ($("#Custom_UIControl").val()=="Text Area" && $("#Custom_DataType").val()=="Integer"){
                    $("#Msg_Responsetype").hide();
                    $("#Msg_UIControl").hide();
                    $("#Msg_Custom").hide();
                    $("#Msg_DataType").hide();
                    $("#Msg_Width").hide();
                    $("#Msg_Rows").hide();
                    $("#Msg_Invalid").show();
                    return false;
                }
                if ($("#Custom_UIControl").val()=="Text Area" && $("#Custom_DataType").val()=="Date"){
                    $("#Msg_Responsetype").hide();
                    $("#Msg_UIControl").hide();
                    $("#Msg_Custom").hide();
                    $("#Msg_DataType").hide();
                    $("#Msg_Width").hide();
                    $("#Msg_Rows").hide();
                    $("#Msg_Invalid").show();
                    return false;
                }
              //Columns (and Rows for Text area) should be required fields, because we should not assign a default value.
                if ($("#Custom_UIControl").val()=="Text Area" && $("#Custom_DataType").val()=="String"){
                	//alert("width="+$("#width").val());
                	//alert("rows="+$("#rows").val());
                	if ($("#width").val() =="" && $("#rows").val() ==""){
                		$("#Msg_Responsetype").hide();
                        $("#Msg_UIControl").hide();
                        $("#Msg_Custom").hide();
                        $("#Msg_DataType").hide();
                        $("#Msg_Invalid").hide();
                        $("#Msg_Width").show();
                        $("#Msg_Rows").show();
                        $("#Msg_Width").focus();
                        return false;
                	}
                	if ($("#width").val() ==""){
                		$("#Msg_Responsetype").hide();
                        $("#Msg_UIControl").hide();
                        $("#Msg_Custom").hide();
                        $("#Msg_DataType").hide();
                        $("#Msg_Invalid").hide();
                        $("#Msg_Rows").hide();
                        $("#Msg_Width").show();
                        $("#Msg_Width").focus();
                        return false;
                	}
                	if ($("#rows").val() ==""){
                		$("#Msg_Responsetype").hide();
                        $("#Msg_UIControl").hide();
                        $("#Msg_Custom").hide();
                        $("#Msg_DataType").hide();
                        $("#Msg_Invalid").hide();
                        $("#Msg_Width").hide();
                        $("#Msg_Rows").show();
                        $("#Msg_Rows").focus();
                        return false;
                	}
                }
                
                if ($("#Custom_UIControl").val()=="Dropdown" || $("#Custom_UIControl").val()=="Radio Button" || $("#Custom_UIControl").val()=="Check Box"){                    
                    if ($("#Custom_DataType").val() == "0" && ResponseType =="Custom"){
                        $("#Msg_Responsetype").hide();
                        $("#Msg_UIControl").hide();
                        $("#Msg_Custom").hide();
                        $("#Msg_DataType").show();
                        $("#Msg_Width").hide();
                        $("#Msg_Rows").hide();
                        $("#Custom_DataType").focus();
                        return false;
                    }
                   
                }
                if ($("#Dynamic_UIControl").val()=="Dropdown" || $("#Dynamic_UIControl").val()=="Radio Button" || $("#Dynamic_UIControl").val()=="Check Box"){                 	
                    if ($("#Dynamic_DataType").val() == "0" && ResponseType =="Dynamic"){
                        $("#Msg_Responsetype").hide();
                        $("#Msg_UIControl").hide();
                        $("#Msg_Custom").hide();
                        $("#Msg_Width").hide();
                        $("#Msg_Rows").hide();
                        $("#Msg_DataType").show();
                        $("#Dynamic_DataType").focus();
                        return false;
                    }

                }
            }
            //add validator begin
            //type check number/date
			var displayWidthFlag = $("#div_display").css("display");			
			var displayWidthValue = "";
			if (displayWidthFlag == "none"){
				$("#display_width").val("");
			}else{
				displayWidthValue = $("#display_width").val();
			}
			if (displayWidthValue != ""){
				if (isInteger($("#display_width")) ==false){					
                	return false;
            	}
			}
			
            if (isInteger($("#width")) ==false || isInteger($("#rows")) ==false || isInteger($("#maxResponses_sq_float")) ==false || isInteger($("#maxResponses_sq_checkbox")) ==false ){
                return false;
            }

            if (isDigital($("#minResponseValue_sq_float")) ==false || isDigital($("#maxResponseValue_sq_float")) ==false || isInteger($("#minResponseValue_sq_textarea")) ==false || isInteger($("#maxResponseValue_sq_textarea")) ==false ){
                return false;
            }
            if (isInteger($("#minResponseValue_sq_int")) ==false || isInteger($("#maxResponseValue_sq_int")) ==false){
                return false;
            }

            if (checkIsValidDate($("#minResponseValue_sq_date").val()) ==false || checkIsValidDate($("#maxResponseValue_sq_date").val()) ==false){
                $("#Msg_Date").show();
                $("#Msg_Date").focus();
                return false;
            }else{
                $("#Msg_Date").hide();
            }


            if ($("#minResponseValue_sq_textarea").val() != ""){
                $("#Msg_MaxResponse").hide();
                $("#Msg_MaxResponseInput").hide();
                if ($("#maxResponseValue_sq_textarea").val() ==""){
                    $("#Msg_MaxResponseInput").show();
                    $("#maxResponseValue_sq_textarea").focus();
                    return false;
                }else{
                    if (Number($("#maxResponseValue_sq_textarea").val())<Number($("#minResponseValue_sq_textarea").val())){
                        $("#Msg_MaxResponse").show();
                        $("#maxResponseValue_sq_textarea").focus();
                        return false;
                    }
                }
            }
            if ($("#minResponseValue_sq_string").val() != ""){
                $("#Msg_MaxResponse").hide();
                $("#Msg_MaxResponseInput").hide();
                if ($("#maxResponseValue_sq_string").val() ==""){
                    $("#Msg_MaxResponseInput").show();
                    $("#maxResponseValue_sq_string").focus();
                    return false;
                }else{
                    if (Number($("#maxResponseValue_sq_string").val())<Number($("#minResponseValue_sq_string").val())){
                        $("#Msg_MaxResponse").show();
                        $("#maxResponseValue_sq_string").focus();
                        return false;
                    }
                }
            }
            if ($("#minResponseValue_sq_float").val() != ""){
                if ($("#maxResponseValue_sq_float").val() ==""){
                    $("#Msg_MaxResponseInput").show();
                    $("#maxResponseValue_sq_float").focus();
                    return false;
                }else{

                    if (Number($("#maxResponseValue_sq_float").val())<Number($("#minResponseValue_sq_float").val())){
                        $("#Msg_MaxResponse").show();
                        $("#maxResponseValue_sq_float").focus();
                        return false;
                    }else{
                        $("#Msg_MaxResponse").hide();
                        $("#Msg_MaxResponseInput").hide();
                    }
                }

            }
            if ($("#minResponseValue_sq_int").val() != ""){
                if ($("#maxResponseValue_sq_int").val() ==""){
                    $("#Msg_MaxResponseInput").show();
                    $("#maxResponseValue_sq_int").focus();
                    return false;
                }else{

                    if (Number($("#maxResponseValue_sq_int").val())<Number($("#minResponseValue_sq_int").val())){
                        $("#Msg_MaxResponse").show();
                        $("#maxResponseValue_sq_int").focus();
                        return false;
                    }else{
                        $("#Msg_MaxResponse").hide();
                        $("#Msg_MaxResponseInput").hide();
                    }
                }

            }
            if ($("#minResponseValue_sq_date").val() != ""){
                if ($("#maxResponseValue_sq_date").val() ==""){
                    $("#Msg_MaxResponseInput").show();
                    $("#maxResponseValue_sq_date").focus();
                    return false;
                }else{
                    if (checkDateEarlier($("#minResponseValue_sq_date").val(),$("#maxResponseValue_sq_date").val())==false){
                        $("#Msg_MaxResponse").show();
                        $("#maxResponseValue_sq_date").focus();
                        return false;
                    }else{
                        $("#Msg_MaxResponse").hide();
                        $("#Msg_MaxResponseInput").hide();
                    }
                }
            }
            if ($("#maxResponses_sq_checkbox").val() != ""){
                $("#Msg_MaxSelect").hide();
                if ($("#entries_value_check").val() !=""){
                    if (Number($("#maxResponses_sq_checkbox").val()) > Number($("#entries_value_check").val())){
                        $("#Msg_MaxSelect").show();
                        $("#maxResponses_sq_checkbox").focus();
                        return false;
                    }
                }
            }
            //max>min
            //add validater end
            var thisURL =document.URL;
            if (thisURL.indexOf("from=http")>0){
            	thisURL = thisURL.substr(0,thisURL.indexOf("from=http"));
            }
            var tmpUPage = thisURL.split("/");
            var thisUPage = tmpUPage[tmpUPage.length-1];
            var thisUPage = thisUPage.substr(0, thisUPage.indexOf(".html"));            
            afterSubmitRedirect("question", thisUPage+".html", submitAction, "submitAction");
        }
    });
    
    
}
function msgHide(){
    $("#Msg_Custom").hide();
    $("#Msg_Invalid").hide();
    $("#Msg_SelectResponse").hide();
    $("#Msg_ResponseLable").hide();
    $("#Msg_ResponseValue").hide();
    $("#Msg_Digital").hide();
    $("#Msg_Integer").hide();
    $("#Msg_Date").hide();
    $("#Msg_MaxResponseInput").hide();
    $("#Msg_MaxResponse").hide();
    $("#Msg_MaxSelect").hide();
    $("#Msg_Width").hide();
    $("#Msg_Rows").hide();
}

function isDigital(obj){
    $("#Msg_Digital").hide();
    if (obj.val() != ""){
        var patrn=/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/;
        if (patrn.exec(obj.val())){            
            $("#Msg_Digital").hide();
            return true;
        }
        else{            
            $("#Msg_Digital").show();            
            obj.focus();
            return false;
        }
    }
    return true;
}

function isInteger(obj){
    $("#Msg_Integer").hide();
    if (obj.val() != ""){
        var patrn=/^-?[0-9]*$/;
        if (patrn.exec(obj.val())){
            $("#Msg_Integer").hide();
            return true;
        }
        else{
            $("#Msg_Integer").show();
            obj.focus();
            return false;
        }
    }
    return true;
}